<template>
  <div id="app">
    <div id="nav">
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link> | 
      <router-link to="/contact">Contact</router-link>
    </div>
    <span>这就是App 上方</span>
    <div style="margin: 100px 0px; border: 1px solid red;padding: 100px 0px;">
      
      <router-view/>

    </div>
    <span>这就是App 下方</span>
    <hr>
    <div></div>
    <button @click="gohome">go home</button> |
    <button @click="goabout">go about</button> |
    <button @click="gocontact">go contact</button> |
    <button @click="goback">go back</button>
  </div>
</template>
<script>
export default {
  methods: {
    gohome: function () {
      this.$router.push({path: '/'})
    },
    goabout: function () {
      this.$router.push({name: "About", params: {page: 'aboutpage'}})
    },
    gocontact: function () {
      this.$router.push({path: '/contact', query: {page: 'conatactpage'}})
    },
    goback: function () {
      this.$router.go(-1)
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}

</style>
